﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;

namespace Mighty.Lib.SensedTypes
{
    class Class : IClass
    {

        public Class(Type type, INamespace parent)
        {
            if (!type.IsClass) throw new Exception("Attempting to instantiate a class object with a Type that is not a class!");
            _name = type.Name;
            _parent = parent;
            _senseType = SenseTypes.Class;
            _children = new List<IClassContent>();
            
            // set modifiers
            _modifiers = new List<ClassModifier>();
            //_accessPermissionLevel = ??
            
        }

        public void Update(Type type)
        {

        }

        public void InspectSelf()
        {

            MethodInfo[] methods = _type.GetMethods();
            MemberInfo[] members = _type.GetMembers();
            PropertyInfo[] properties = _type.GetProperties();

        }

        #region Properties

        private List<IClassContent> _children = null;
        public List<IClassContent> Children
        {
            get
            {
                return _children;
            }
        }

        private AccessPermissionModifier _accessPermissionLevel;
        public AccessPermissionModifier AccessPermissionLevel
        {
            get
            {
                return _accessPermissionLevel;
            }
        }

        private List<ClassModifier> _modifiers = null;
        public List<ClassModifier> Modifiers
        {
            get
            {
                return _modifiers;
            }
        }

        private Type _type = null;
        public Type Type
        {
            get
            {
                return _type;
            }
        }

        private string _name = null;
        public string Name
        {
            get
            {
                return _name;
            }
            set
            {
                _name = value;
            }
        }

        private SenseTypes _senseType;
        public SenseTypes SenseType
        {
            get
            {
                return _senseType;
            }
            set
            {
                _senseType = value;
            }
        }


        private INamespace _parent = null;
        public INamespace Parent
        {
            get
            {
                return _parent; 
            }
            set
            {
                _parent = value;
            }
        }


        #endregion
    }
}
